<template>
	<view class="mymap">
		<web-view :src="myurl"></web-view>

		<!-- 引入需要嵌入的h5 链接 -->
		<!-- <web-view @message="message" src="http://192.168.2.23:8080"></web-view> -->

		<!-- //在methods中接收h5发送的消息/*** @information message中 接收到的是由h5项目通过uni.postMessage中传递出来的数据，以数组的形式接收每次的消息*/message(event){console.log('接收到消息'，event.detail.data)} -->
	</view>
</template>

<script>
export default {
	data() {
		return {
			myurl: '',
		}
	},

	onLoad(options) {
		let params = JSON.parse(options.item);
		let scheduleDayList = params.scheduleList.map(s=>{
			return s.scenicSpotList.map(ss=> ss.generalSpot.mapId)
		})
		scheduleDayList = JSON.stringify(scheduleDayList);
		let authorization = uni.getStorageSync('access_token') || '';
		
		uni.getLocation({
		  type: 'gcj02', //设置type为gcj02
		  isHighAccuracy: true,
		  success: async (res) => {
		    const {
		      latitude,
		      longitude
		    } = res;
			
			this.myurl = 'https://i.ringzle.com/h5/#/customtour?scheduleDayList=' + scheduleDayList + '&authorization=' + authorization+ "&lon=" + longitude + "&lat=" + latitude;
		  }
		});
	},
	methods: {

	}
}
</script>

<style>
/* #ifdef H5 */
/* 页面A */
uni-page[data-page="pages/touristMap/index"] .uni-page-head-hd {
	display: none;
}

/* #endif */
/* #ifdef H5 */
uni-page-head {
	display: none;
}

/* #endif */

.mymap {
	width: 100%;
	height: calc(100vh - 45px);
}
</style>
